/* 购物车 */
function Shopping(img, name, weith, money, originalMoney, num, ) {
    this.img = img; //商品照片
    this.name = name; //商品名称
    this.weith = weith; //商品重量什么的
    this.money = money; //折后价
    this.originalMoney = originalMoney; //原价
    this.num = num; //数量
    this.allPrices = this.money * this.num; //总价
}
var arr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "e", "f", "g", "A", "B", "C", "D", "E", "F", "G"];
/* 订单 */
function orderForm(img, commodity, count, price, money) {
    let i = "";
    for (let i = 0; i < 8; i++) {
        i += Math.round(Math.random() * 10);
    }

    var sum = "";
    for (var j = 0; j < 20; j++) {
        var num = Math.floor(Math.random() * arr.length);
        sum += arr[num];
    }

    this.id = i; //订单号
    this.expressage = sum; //快递号
    this.img = img;
    this.state = "未付款"; //订单状态 已发货  ||未发货 
    this.site = new site(); //收获地址
    this.commodity = commodity; //商品名称
    this.money = money;
    this.count = count; //商品总数
    this.price = price; //总价
}

/* 收货地址 */
function site(UserName, reapSite, detailed, number) {
    this.UserName = UserName; //收货人姓名
    this.reapSite = reapSite; //收获地址
    this.detailed = detailed; //详细地址
    this.number = number; //手机号
}

function User(admin, password) {
    this.admin = admin; //账号或者手机号
    this.password = password; //密码
    this.shopping = new Array(); //购物车
    this.orderForm = new Array(); //我的订单
    this.UserSite = new Array(); //收货地址
}

/* 用户数组 */
let ary = new Array();

/* 登陆的数组 */
let log = new Array();

module.exports = {
    User,
    ary,
    log,
    Shopping,
    orderForm,
    site
}